/********************************************/
  // Creation History
  // --------------------------------------------------------------
  //	Company:			HTHK
  //	NAME:				StaffProjectProcess.java
  //    Title   :			some operations about Staff Project such as 
  //                        CreateBean,Insert,Update,Delete,Find  
  //	FUNCTION:			
  //	BY:				Poly Li
  //	DATE:				12/01/2004
  // --------------------------------------------------------------
/*********************************************/
// Copyright (c) 2002 HTHK

package tss.multiproject;

import java.sql.Connection;
import java.util.Vector;

import org.apache.log4j.Logger;

import com.ffpc.sql.BaseSqlCommand;
import com.ffpc.sql.Column;
import com.ffpc.sql.DataException;

/**
 * A Class class.
 * <P>
 * @author HTHK
 */
public class StaffProjectProcess
{
	private static Logger logger = Logger.getLogger(StaffProjectProcess.class);
    public static StaffProjectBean createBean()
    {
        return new StaffProject();
    }

    public static  int insert(Connection con, StaffProjectBean staffProjectBean)
      throws DataException
    {
        StaffProject staffProject = (StaffProject)staffProjectBean;
        staffProject.setConnection(con);
        return staffProject.insert();
    }

    public static int update(Connection con, StaffProjectBean staffProjectBean)
      throws DataException
    {
    	logger.debug(staffProjectBean.getStaff_no());
        StaffProject staffProject = (StaffProject)staffProjectBean;
        staffProject.setConnection(con);
        return staffProject.update();
    }

    public static int delete(Connection con, StaffProjectBean staffProjectBean)
      throws DataException
    {
        StaffProject staffProject = (StaffProject)staffProjectBean;
        staffProject.setConnection(con);
        return staffProject.delete();
    }

    public static StaffProjectBean[] find(Connection con, StaffProjectBean staffProjectBean)
      throws DataException
    {
        StaffProject staffProject = (StaffProject)staffProjectBean;
        BaseSqlCommand buc = new BaseSqlCommand(con);
        Vector rows = buc.find(staffProject);
        StaffProjectBean[] beans = new StaffProject[rows.size()];
        for (int i=0;i<rows.size();i++)
        {
            StaffProject bean = new StaffProject();
            bean.setColumns((Column[])rows.get(i));
            beans[i] = bean;
        }
        return beans;
    }
}


